#!/usr/bin/env bash


start(){
    echo "stop"
    nohup java -jar hack-0.0.1-SNAPSHOT.jar &
    echo $! > server.pid
}

stop(){
    echo "stopping"
    PID=$(cat server.pid)
    kill -9 $PID
    rm -rf server.pid
}

restart(){
    echo "restart"
    stop
    sleep 1
    start
}




case $1 in
  start)
    start ;;
  stop)
    stop ;;
  restart)
    restart;;
  *)
    echo '{start|stop|status|restart}' ;;
esac
